<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>秒杀</title>
</head>
<body>
秒杀界面
<div id="nav">
    <button :isdisabled="isDisabled" @click="seckill">秒杀商品</button>
</div>

<script src="js/vue3.js"></script>
<script src="js/axios.min.js"></script>
<script>
    const {createApp} = Vue

    createApp({
        data() {
            return {
                isDisabled:false
            }
        },
        methods: {
            seckill() {
                //发起axios请求
                axios.get('/kill?pid=1001')
                    .then(response => {
                        if(response.data.code == '200'){
                            alert(response.data.message);
                        }else{
                            this.isDisabled = true;
                            alert(response.data.message);
                        }
                    })
            }
        }
    }).mount('#nav')
</script>
</body>
</html>